The event passed to formatEventTime() is reused at a later point.
Therefore, we are not allowed to manipulate the event directly.
This fixes an issue where the user clicks on a multi-day all-day event
the second time before the event gets garbage collected and the event
then is one day shorter.
Fixes
528ee01fef6e5ca2303fc766be29a854d8ee928b
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2184>
_formatEventTime(event) {
const eventStart = event.date;
- const eventEnd = event.end;
+ let eventEnd = event.end;
const allDay =
eventStart.getTime() === this._startDate.getTime() && eventEnd.getTime() === this._endDate.getTime();
const startYear = eventStart.getFullYear();
- if (endsAtMidnight)
+ if (endsAtMidnight) {
+ eventEnd = new Date(eventEnd);
eventEnd.setDate(eventEnd.getDate() - 1);
+ }
const endYear = eventEnd.getFullYear();